// http://192.168.0.220:8081
const axios = require('axios')

const instance = axios.create({
  // baseURL: process.env.waterElectricity_API,
  // baseURL: '/hydropower',
  baseURL: 'http://localhost:8001/hydropower',
  headers: {
    'Content-Type': 'application/json'
  }
})

// 添加请求拦截器
instance.interceptors.request.use(function (config) {
  return config
}, function (error) {
  console.log(111)
  return Promise.reject(error, 111)
})

// 添加响应拦截器
instance.interceptors.response.use(function (res) {
  return res
}, function (error) {
  console.log(error)
  return Promise.reject(error)
})

module.exports = instance
